<?php
	session_start();

	$strUsername = trim($_POST["tUsername"]);
	$strPassword = trim($_POST["tPassword"]);

	if(trim($strUsername) == "")
	{
		echo "<font color=red>** Plase enter username.</font>";
		exit();
	}
	
	if(trim($strPassword) == "")
	{
		echo "<font color=red>** Plase enter password.</font> ";
		exit();
	}
	
	include 'connectDB.php';

	$strSQL = "SELECT * FROM tbl_user WHERE username = '".$strUsername."' and password = '".$strPassword."' ";
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
	$objResult = mysql_fetch_array($objQuery);
	if($objResult)
	{
		echo "Y";

		//*** Session ***//
		$_SESSION["username"] = $strUsername;
		session_write_close();
	}
	else
	{
		echo "<font color=red>** Username or Password is incorrect!</font>";
	}
	
	mysql_close($objConnect);
?>